How to perform calculations on data in a query.In Query Design View, use the 'Totals' row of the query to create a predefined calculation on all records or enter an expression in the 'Field' cell to create a custom calculation. 1) If the Database window is not active, activate the Database window. 2) Choose the 'Queries' tab in the Database window. < 3) Select the desired query in the list box. (The selected query is highlighted.) 4) Choose the 'Design' button. (The query appears in Design View.) 5) To perform a calculation based on a group of records or all records, do the following: a) Select the 'View' menu and select 'Totals'. (The Totals row appears in the query grid.) < b) Click in the 'Totals' cell of the desired field. (A down arrow appears.) c) Choose the down arrow. (A drop-down list appears.) d) Select one type of total from the 'Totals' drop-down list. NOTE: Predefined calculations include sun, average, count, minimum, maximum, standard deviation, and variance. e) Repeat steps 5)b) through 5)d) for each additional calculation of fields. f) Select the 'Query' menu and select 'Run' to view the results of the calculation. 6) To perform a custom calculation for each record, do the following: a) Click in a blank cell of the 'Field' row. (The cursor blinks.) b) Enter the desired calculation using the following syntax < Expression > :[fieldname] operator [fieldname] EXAMPLE: Total:[Unit Price] * [Quantity] (where < Total > is the expression name to store the value, [Unit Price] is a field name in the underlying table or query, '*' is to multiply, and [Quantity] is a field name in the underlying table or query). c) Repeat steps 6)a) and 6)b) for each additional custom calculation. d) Select the 'Query' menu and select 'Run' to view the results of the query. 7) Select the 'File' menu and select 'Save' to save changes to the query. Knowledge-Pak Desktop Suite (TM) Edition 5 Copyright (c) 1994-1997 by ServiceWare Inc. Subject to the terms set forth in the end-user license agreement. All rights reserved. Subject to the terms set forth in the end-user license agreement. All rights reserved. |